<!--
		NOTE: You shouldn't use these templates directly. Instead, use the global
		{{loginButtons}} template. For positioning on the right side of your app,
		try {{loginButtons align="right"}}
	-->

<template name="_loginButtons">
	{{#if currentUser}}
		{{#unless loggingIn}}
			{{> _loginButtonsLoggedIn}}
		{{/unless}}
	{{else}}
		{{> _loginButtonsLoggedOut}}
	{{/if}}
</template>

<template name="_loginButtonsLoggedIn">
	{{> _loginButtonsLoggedInDropdown}}
</template>

<template name="_loginButtonsLoggedOut">
	{{#if services}} {{! if at least one service is configured }}
		{{#if configurationLoaded}}
			{{#if dropdown}} {{! if more than one service configured, or password is configured}}
				{{> _loginButtonsLoggedOutDropdown}}
			{{else}}
				{{#with singleService}} {{! at this point there must be only one configured services }}
					{{#unless logginIn}}
						<div class="navbar-form">
							{{> _loginButtonsLoggedOutSingleLoginButton}}
						</div>
					{{/unless}}
				{{/with}}
			{{/if}}
		{{/if}}
	{{else}}
		<div class="no-services">{{i18n 'loginButtonsLoggedOut.noLoginServices'}}</div>
	{{/if}}
</template>

<!-- used in various places to display messages to user -->
<template name="_loginButtonsMessages">
	{{#if errorMessage}}
		<div class="alert alert-danger">{{errorMessage}}</div>
	{{/if}}
	{{#if infoMessage}}
		<div class="alert alert-success no-margin">{{infoMessage}}</div>
	{{/if}}
</template>

